package com.jdk.demo.thread.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerTest {

	private static AtomicInteger count = new AtomicInteger(0);

	public static void increment() {
        count.getAndIncrement();
    }

	public static void main(String[] args) throws InterruptedException {
		for (int i = 0; i < 10; i++) {
			Thread s = new Thread(() -> {
				for (int j = 0; j < 100; j++) {
					increment();
				}
			});
			s.start();
		}
		Thread.sleep(500);
		System.out.println(count.get());
	}


}
